var pools=[1,5], n=2, hash=[];
hash[1] = 1;
hash[5] = 1;

function getP() {
    n++;
    var tmp = n*(3*n-1)/2
    pools.push(tmp);
    hash[tmp] = 1;
    return tmp;
}

while(1) {
    var sum = getP();
    for(var i=0; i<pools.length; i++) {
        var b = pools[i];
        var a = sum - pools[i];
        if(hash[a]) {
            if(hash[Math.abs(a-b)]){
                print("Find...." + a + "," + b + ", " + sum);
                print(Math.abs(a-b));
                break;
            }
        }
    }
}


